﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using Daycare.Models;

namespace Daycare.DAL
{
    public class MembershipRepository
    {
        public DataTable GetAllRoles(String loweredApplicationName)
        {
            DataTable tempTable = new DataTable();
            
            try
            {
                using (SqlConnection con = new SqlConnection(Configuration.ConnectionString))
                {
                    using (SqlCommand comm = new SqlCommand("dbo.GetAllRoles", con))
                    {
                        comm.CommandType = CommandType.StoredProcedure;
                        comm.Parameters.AddWithValue("@LoweredApplicationName", loweredApplicationName);

                        SqlDataAdapter da = new SqlDataAdapter(comm);
                 
                        da.Fill(tempTable);

                        return tempTable;
                    }
                }
            }
            catch(SqlException)
            {
                return tempTable;
            }
        }
    }
}